<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="stylesheet" href="/static/mbyz/css/public.css">
    <link rel="stylesheet" href="/static/mbyz/css/index.css">
    <title></title>

</head>
<body>
<!--<div class="tetx">LODING...</div>-->
<img src="/static/mbyz/img/1.png" alt="" id="img">
<div class="loading_fater">
    <div class="loading"></div>
    <span style="color: #ffc572;"><label class="bfb">0</label>%</span>
<div class="titles">老会员参与游戏温馨提示</div>
 <div class="con-1">【1】如您已经成为砂之船西安奥莱会员，请您确认是否登录智慧商场，智慧商场已经登录的老会员可以直接参与游戏；<br />
    * 智慧商场登录路径：搜索砂之船西安奥莱服务号—点击会员注册查看登录状态</div>
<div class="con-2">【2】智慧商场未登陆的老会员进入游戏后，请点击弹出对话框中的"确定"按钮进行登录后，再次进入游戏即可参与。</div>
</body>
<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
<!--<script type='text/javascript' src='/static/mbyz/js/jquery.validate.min.js' charset='utf-8'></script>-->
<script type='text/javascript' src='/static/mbyz/js/mobile-detect.js' charset='utf-8'></script>
<script type="text/javascript">
    var url = window.location.href;
    console.log(url, '24');
    var phone = $("#phone").val();
    //判断数组中是否包含某字符串
    Array.prototype.contains = function (needle) {
        for (i in this) {
            if (this[i].indexOf(needle) > 0)
                return i;
        }
        return -1;
    };
    var device_type = navigator.userAgent;//获取userAgent信息
    console.log(device_type, '85');
    var md = new MobileDetect(device_type);//初始化mobile-detect
    console.log(md.version('Webkit'), '145');         // 534.3
    var device_id = md.version('Webkit');
    var os = md.os();//获取系统
    var model = "";
    if (os == "iOS") {
        os = md.os() + md.version("iPhone");
        model = md.mobile();
        console.log(model, '150')
    } else {
        console.log('130');
        os = md.os() + md.version("Android");
        var sss = device_type.split(";");
        var i = sss.contains("Build/");
        console.log(i);
        if (i > -1) {
            model = sss[i].substring(0, sss[i].indexOf("Build/"));
            console.log(model, '135')
        } else {
            console.log('136')
        }
    }
    updateLoading(10, 1);
    //用延迟  模拟加载文件需要的时间
    setTimeout(function () {
        updateLoading(60, 1);
        updateimg(40, 1)
    }, 1000);
    $.ajax({
        type: "GET",
        url: 'http://sasseur.pi-bc.com/mbyz/check_register',
        data: {device_id: device_id},
        success: function (data) {
            console.log(data, '44');
            var code_data = JSON.parse(data)
            var code = code_data.errcode;
            if (typeof (code_data.room)) {
                var room = code_data.room;
                console.log(room, 'room')
            }
            if (typeof (code_data.num)) {
                var num = code_data.num;
            }
            if (code === 400) {
                console.log(room, 'room1')
                console.log(num, 'room1')
                //未注册会员
                console.log('400');
                setTimeout(function () {
                    updateLoading(99, 1);
                    updateimg(60, 1);
                    setTimeout(() => window.location.replace(`http://sasseur.pi-bc.com/mbyz/send_page?room=${room}&num=${num}`), 1000);
                }, 3000);
            } else {
                console.log(room, 'room2');
                //老会员
                //游戏
                setTimeout(function () {
                    updateLoading(99, 1);
                    updateimg(60, 1);
                    if(room==''||num==''){
                        // alert('num为空');
                        var o='o';
                        // setTimeout(() => window.location.replace(`http://sasseur.pi-bc.com/mbyz/send_page?room=${room}&num=${num}`), 1000);
                        setTimeout(() => window.location.replace(`http://mob.pi-bc.com/v3/idea/JWZSQpSU?type=${o}`), 1000);
                    }else{
                        // alert('num不为空');
                        var yo='yo';
                        // setTimeout(() => window.location.replace(`http://sasseur.pi-bc.com/mbyz/send_page?room=${room}&num=${num}`), 1000);
                        setTimeout(() => window.location.replace(`http://mob.pi-bc.com/v3/idea/JWZSQpSU?type=${yo}&room=${room}&num=${num}`), 1000);
                    }
                }, 3000);
            }
        },
    });
    var bfb = document.getElementsByClassName('bfb')[0];

    /**
     * 更新进度条
     * @param {Object} bfb_num ：更新进度条数字baifenbi （10）
     * @param {Object} millisecond :动画执行毫秒数
     */
    function updateLoading(bfb_num, millisecond) {
        document.getElementsByClassName('loading')[0].style.cssText = 'width: ' + bfb_num + '%;transition-duration:' + millisecond + 's;'
        var load_Interval = setInterval(function () {
            if (bfb.innerHTML < bfb_num) {
                bfb.innerHTML = parseInt(bfb.innerHTML) + 1;
            } else {
                clearInterval(load_Interval);
            }
        }, millisecond * 1000 / bfb_num)
    }

    function updateimg(bfb_num, millisecond) {
        document.getElementById('img').style.cssText = 'margin-left: ' + bfb_num + '%;transition-duration:' + millisecond + 's;'
        var load_Interval = setInterval(function () {
            if (bfb.innerHTML < bfb_num) {
                bfb.innerHTML = parseInt(bfb.innerHTML) + 1;
            } else {
                clearInterval(load_Interval);
            }
        }, millisecond * 1000 / bfb_num)
    }
</script>
</html>